<template>
  <div class="content">
    <div class="list_box" v-if="list.length">
        <div class="list" v-for="(item, index) in list" :key="index">
            <div class="left">
                <p class="title">{{ item.title }}</p>
                <p class="time">{{ item.createTime }}</p>
            </div>
            <p class="price">-{{ item.price }}</p>
        </div>
    </div>
    <div class="no_data" v-else>
        <img src="/static/no-data.png" alt="" />
        <p>暂无相关余额明细～</p>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex"
import api from "@/api"
import { formatDateAll } from '@/utils/utils.js'
export default {
  data() {
    return {
        query: {
          pageNo: 1,
          pageSize: 10,
        },
        list: [],
    }
  },
  computed: {
    
  },
  methods: {
    getWalletDetail() {
      api.user.getWalletDetail(this.query).then((res) => {
        if (res.code === 200) {
            res.data.list.map(item=>{
                item.createTime = formatDateAll(item.createTime)
            })
            this.list = res.data.list
        }
      })
    },
  },
  onShow() {
  },
  onLoad() {
    this.getWalletDetail()
  },
}
</script>

<style lang="scss" scoped>
.content {
    min-height: 100vh;
    background: #f7f7f7;
    padding-top: 1rpx;
}
.list_box {
    margin-top: 20rpx;
    .list {
      padding: 26rpx;
      background: #fff;
      border-radius: 8rpx;
      margin-bottom: 20rpx;
      display: flex;
      justify-content: space-between;

      .title {
        font-size: 30rpx;
        color: #666666;
        margin-bottom: 6rpx;
      }

      .time {
        font-size: 24rpx;
        color: #999;
      }

      .price {
        font-size: 30rpx;
        font-weight: 500;
        color: #3b74f5;
      }
    }
}
.no_data {
        text-align: center;
        margin-top: 100rpx;
    img {
        width: 320rpx;
        height: 320rpx;
    }

    p {
        font-size: 24rpx;
        color: #999999;
        margin-top: -40rpx;
    }
}
</style>
